package cn.bs.seckill.controller;


import cn.bs.seckill.rabbitMQ.Sender;
import com.sun.net.httpserver.Authenticator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/*本类用于测试*/
@Controller
@RequestMapping("/test")
public class TestController {

    @Autowired
    private Sender sender;

    //测试页面跳转
    @RequestMapping("/hello")
    public String hello(Model model){
         model.addAttribute("msg","老王");
         return "hello";
    }

    //测试广播模式
    @RequestMapping("/mq/fanout")
    @ResponseBody
    public void fmq(){

        sender.fsend("有口碑找老张,学习java不得慌");
    }
    //测试路由模式
    @RequestMapping("/mq/direct1")
    @ResponseBody
    public void dmq1(){
        sender.dsend1("有口碑找老张,学习java不得慌");
    }
    @RequestMapping("/mq/direct2")
    @ResponseBody
    public void dmq2(){
        sender.dsend2("有口碑找老张,学习java不得慌");
    }
    //测试主题模式
    @RequestMapping("/mq/topic1")
    @ResponseBody
    public void tmq1(){
        sender.tsend1("有口碑找老张,学习java不得慌");
    }
    @RequestMapping("/mq/topic2")
    @ResponseBody
    public void tmq2(){
        sender.tsend2("有口碑找老张,学习java不得慌");
    }
}
